package cn.lili.modules.operationcenter.client;

import cn.lili.modules.constant.ServiceConstant;
import cn.lili.modules.operationcenter.entity.dos.OperationCenter;
import cn.lili.modules.operationcenter.entity.dos.OperationCenterWithdrawal;
import cn.lili.modules.operationcenter.entity.vos.OperationCenterSearchPageParams;
import cn.lili.modules.operationcenter.entity.vos.OperationCenterVo;
import cn.lili.modules.operationcenter.fallback.OperationCenterFallback;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(path = "${server.servlet.context-path}", name = ServiceConstant.OPERATION_CENTER_SERVICE, contextId = "operation-center", fallback = OperationCenterFallback.class)
public interface OperationCenterClient {
    /**
     * 获取当前登录运营中心信息
     *
     * @return 店铺信息DO
     */
    @GetMapping("/feign/operation_center/{userId}/getOperationCenter")
    OperationCenter getOperationCenter(@PathVariable String userId);

    /**
     * 增加运营中心
     *
     * @param operationCenter 后台添加运营中心信息
     * @return 运营中心
     */
    @PostMapping("/feign/operation_center/addOperationCenter")
    void addOperationCenter(@RequestBody OperationCenter operationCenter);

    /**
     * 分页查询运营中心
     *
     * @param operationCenterSearchPageParams 查询参数
     * @return 运营中心分页
     */
    @PostMapping("/feign/operation_center/page")
    Page<OperationCenterVo> page(@RequestBody OperationCenterSearchPageParams operationCenterSearchPageParams);

    /**
     * 根据省份ID获取运营中心信息
     * @param provinceId 省份ID
     * @return
     */
    @GetMapping("/feign/operation_center/getByAreaId")
    OperationCenter getByAddressId (@RequestParam String provinceId);

    @GetMapping("/feign/operation_center/getById")
    OperationCenter getById (@RequestParam String id);

    /**
     * 获取运营中心下拉列表
     * @return
     */
    @GetMapping("/feign/select")
    List<OperationCenter> select();

    /**
     * 根据proviceId list批量获取OperationCenter集合
     * @param provinceIdList
     * @return
     */
    @PostMapping("/feign/operation_center/getOperationCenterListByProviceIds")
    List<OperationCenter> getOperationCenterListByProviceIds(@RequestBody List<String> provinceIdList);

    @GetMapping("/feign/operation_center/getList")
    List<OperationCenter> getList ();

    @PostMapping("/feign/operation_center/insertWithdrawal")
    void insertWithdrawal (@RequestBody OperationCenterWithdrawal operationCenterWithdrawal);
}
